package com.nkym.service.impl;/*
 * @ClassName InnerUserServiceImpl
 * @Desc TODO
 * @Author 19637
 * @Date 2023/4/24 23:40
 * @Version 1.0
 */

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nkym.common.BaseResponse;
import com.nkym.common.ErrorCode;
import com.nkym.exception.BusinessException;
import com.nkym.mapper.UserMapper;
import com.nkym.pojo.entity.User;
import com.nkym.pojo.service.InnerUserService;
import com.nkym.utils.ResultUtil;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

@DubboService
public class InnerUserServiceImpl implements InnerUserService {
    @Resource
    UserMapper userMapper;
    @Override
    public User getUserByAccesskey(String accessKey) {
        if (accessKey == null) {
            throw new BusinessException(ErrorCode.PARAM_EMPTY);
        }
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("accessKey", accessKey);
        User user = userMapper.selectOne(wrapper);
        return user;
    }
}
